import React from 'react'
import { message, Popconfirm ,Button} from 'antd';

function Popconfirms({title,record,fn}) {

   const confirm = (e) => {
  
    fn(record)
    message.success('Click on Yes');
  };
  
  const cancel = (e) => {
    console.log(e);
    message.error('Click on No');
  };

  return (
    <div>
        <Popconfirm
            title={`确认${title}吗?`}
            onConfirm={confirm}
            onCancel={cancel}
            okText="Yes"
            cancelText="No"
        >
            <Button href="#">{title}</Button>
        </Popconfirm>
    </div>
  )
}

export default Popconfirms